package com.fang.mmy.items.config;

import com.fang.mmy.items.filter.*;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @ClassName EngineConfig
 * @Author kebukeyi
 * @Date 2022/8/9 18:32
 * @Description
 * @Version 1.0.0
 */
@Configuration
public class EngineConfig {

    public static Map<String, List<LogicFilter>> logicFilterMap = new ConcurrentHashMap<>();

    @Resource
    private  PeopleFilter peopleFilter;

    @Resource
    private  AccountFilter accountFilter;

    @Resource
    private  RoleFilter roleFilter;

    @Resource
    private  CityFilter cityFilter;

    @PostConstruct
    public void init() {
        ArrayList<LogicFilter> peopleFilters = new ArrayList<>();
        peopleFilters.add(peopleFilter);

        ArrayList<LogicFilter> accountFilters = new ArrayList<>();
        accountFilters.add(accountFilter);

        ArrayList<LogicFilter> conditionsFilters = new ArrayList<>();
        conditionsFilters.add(roleFilter);
        conditionsFilters.add(cityFilter);

        logicFilterMap.put("1", peopleFilters);
        logicFilterMap.put("2", accountFilters);
        logicFilterMap.put("3", conditionsFilters);
    }

}
